package com.wujian.love.redis;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;

import java.text.MessageFormat;
import java.util.Date;

/**
 * @ClassName: RedisKey
 * @Description:
 * @Author: wuj
 * @Date: 2021-01-07 15:15
 **/
public class RedisKey {

    public static String getLikeNum(Long informationId) {
        return MessageFormat.format("information:{0}", informationId);
    }


    public static String getLikeNumForUser(Long informationId,Long userId) {
        return MessageFormat.format("information:{0}:{1}", informationId,userId);
    }

    public static String getOrderNumber(Long userId) {
        return MessageFormat.format("orderNumber:{0}",userId);
    }

    /**
     * 用户签到的key
     * @param userId
     * @return
     */
    public static String getSignKey(Long userId) {
        String date = DateUtil.format(new Date(), "yyyyMM");
        return MessageFormat.format("user:sign:{0}:{1}",userId,date);
    }

    public static String getNovelKey(Integer id) {
        String date = DateUtil.format(new Date(), "yyyyMM");
        return MessageFormat.format("novel:{0}",id);
    }



}
